package com.meal.base.test.MyTest;

import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner s1 = new Scanner(System.in);
        String str = s1.nextLine().toLowerCase();
        Scanner s2 = new Scanner(System.in);
        String c = s2.nextLine().toLowerCase();

        if(str == null || "".equals(str)){
            System.out.println(0);
        }else{
            int a = str.length();
            int b = str.replaceAll(c, "").length();
            System.out.println(a - b);
        }
    }
}